﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;

namespace WinFormsApp1
{
    //棋盘类
    class ChessBoard
    {
        //画棋盘的方法
        public static void DrawCB(Graphics g)
        {
            //棋格宽度
            int GapWidth = MainSize.CBoardGap;
            //棋盘数量
            int GapNum = MainSize.CBoardWidth / GapWidth - 1;

            g.Clear(Color.Bisque);//清空棋盘
            Pen pen = new Pen(Color.FromArgb(192, 166, 107));    // 实例化画笔
            //画棋盘
            for (int i = 0; i < GapNum + 1; i++)
            {
                g.DrawLine(pen, new Point(20, i * GapWidth + 20), new Point(GapWidth * GapNum + 20, i * GapWidth + 20));
                g.DrawLine(pen, new Point(i * GapWidth + 20, 20), new Point(i * GapWidth + 20, GapWidth * GapNum + 20));
            }

        }
    }
}
